package com.huc.design.behavior.observer.base;

import java.util.ArrayList;
import java.util.List;

/**
 * @author huc
 * @version 1.0
 * @note
 * @date 2021/10/8 10:47
 */
public abstract  class Subject {
    protected List<Observer> observers = new ArrayList<Observer>();
    //增加观察者方法
    public void add(Observer observer) {
        observers.add(observer);
    }
    //删除观察者方法
    public void remove(Observer observer) {
        observers.remove(observer);
    }
    public abstract void notifyObserver(); //通知观察者方法
}
